﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ApprovalFlow
{
    public class ExecutionResult
    {
        /// <summary>
        /// 是否继续进行
        /// </summary>
        public bool Proceed { get; protected set; }

        /// <summary>
        /// 是否结束审批流程
        /// </summary>
        public bool End { get; protected set; }

        public bool WaitEvent { get; set; }

        /// <summary>
        /// 跳转下一节点
        /// </summary>
        /// <returns></returns>
        public static ExecutionResult Next()
        {
            return new ExecutionResult
            {
                Proceed = true,
            };
        }

        /// <summary>
        /// 结束工作流
        /// </summary>
        /// <returns></returns>
        public static ExecutionResult EndWorkFlow()
        {
            return new ExecutionResult
            {
                Proceed = false,
                End = true,
            };
        }

        /// <summary>
        /// 表示工作状态未完成，等待条件继续验证。
        /// </summary>
        /// <returns></returns>
        public static ExecutionResult Unfinished()
        {
            return new ExecutionResult
            {
                Proceed = false,
            };
        }

        public static ExecutionResult WaitForEvent()
        {
            return new ExecutionResult
            {
                WaitEvent = true,
                Proceed = false,
            };
        }
    }
}
